package cn.keniykey.mc.viewlibrary.reflection;

import java.lang.reflect.Constructor;

/**
 * Class类构造方法
 */
public final class ReflectionConstructor {
	  private final Constructor<?> constructor;
	  
      public ReflectionConstructor(final Constructor<?> constructor) {
          this.constructor = constructor;
          this.constructor.setAccessible(true);
      }
      
      public Constructor<?> getConstructor() {
          return this.constructor;
      }
      public Class<?> getDeclaringClass() {
    	  return this.constructor.getDeclaringClass();
      }
      public Object newInstance(final Object... params) {
          try {
              return this.constructor.newInstance(params);
          }catch (Exception e) {
              throw new RuntimeException(e);
          }
      }
}